/**
 * 长者信息管理
 */


import axios from "axios";

/**
 *  获取上海区域信息
 * @param level
 * @returns {AxiosPromise}
 */
export function get_shanghai_area_axios(level) {
    return axios({
        url: '/data/area/list',
        method: 'get',
        params: {
            level: level
        }
    })
}


/**
 *  获取长者信息列表
 * @param data
 * @returns {*}
 */
export function get_elder_list(data) {
    return axios({
        url: '/person/elder/list',
        method: 'get',
        params: data
    })
}


/**
 *  获取长者详细信息
 * @param data
 * @returns {*}
 */
export function get_elder_info(elderId) {
    return axios({
        url: '/person/elder/' + elderId,
        method: 'get',
    })
}


/**
 * 长者信息新增
 * @param data
 * @returns {AxiosPromise}
 */
export function elder_add(data) {
    return axios({
        url: "/person/elder",
        method: "post",
        data: data
    })
}

/**
 *  长者信息修改
 * @param data
 * @returns {AxiosPromise}
 */
export function elder_update(data) {
    return axios({
        url: "/person/elder",
        method: "put",
        data: data
    })
}

/**
 * 长者信息批量新增
 * @param data
 * @returns {AxiosPromise}
 */
export function elder_upload_file(data) {
    return request2({
        url: "/person/elder/importData",
        method: "post",
        data: data,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}


/**
 *  长者信息删除
 * @param data
 * @returns {*}
 */
export function elder_delete_by_ids(elderIds) {
    return axios({
        url: '/person/elder/' + elderIds,
        method: 'delete',
    })
}


/**
 *  获取长者信息列表
 * @param data
 * @returns {*}
 */
export function get_elder_listBy(data) {
    return axios({
        url: '/person/elder/listBy',
        method: 'get',
        params: data
    })
}


/**
 * 社会信息管理
 */


/**
 *  获取社工信息列表
 * @param data
 * @returns {*}
 */
export function get_socialWork_list(data) {
    return axios({
        url: '/person/worker/list',
        method: 'get',
        params: data
    })
}

/**
 *  获取社工详细信息
 * @param data
 * @returns {*}
 */
export function get_socialWork_info(workerId) {
    return axios({
        url: '/person/worker/' + workerId,
        method: 'get',
    })
}


/**
 * 社会信息新增
 * @param data
 * @returns {AxiosPromise}
 */
export function socialWork_add(data) {
    return axios({
        url: "/person/worker",
        method: "post",
        data: data
    })
}

/**
 *  社会信息修改
 * @param data
 * @returns {AxiosPromise}
 */
export function socialWork_update(data) {
    return axios({
        url: "/person/worker",
        method: "put",
        data: data
    })
}


/**
 *  社会信息删除
 * @param data
 * @returns {*}
 */
export function socialWork_delete_by_ids(workerIds) {
    return axios({
        url: '/person/worker/' + workerIds,
        method: 'delete',
    })
}


/**
 * 社工长者关联关系
 */

/**
 *   获取社工长者关系列表
 * @param data
 * @returns {*}
 */
export function get_workerElder_list(data) {
    return axios({
        url: '/person/workerElder/list',
        method: 'get',
        params: data
    })
}


/**
 * 删除社工长者关系
 * @param ids
 * @returns {*}
 */
export function workerElder_delete_by_ids(ids) {
    return axios({
        url: '/person/workerElder/' + ids,
        method: 'delete',
    })
}


/**
 *  获取社工长者关系列表（未关联）
 * @param workerId
 * @returns {*}
 */
export function get_workerElder_listUnRelated(workerId) {
    return axios({
        url: '/person/workerElder/listUnRelated/' + workerId,
        method: 'get',
    })
}


/**
 *   添加社工长者关系
 * @param data
 * @returns {*}
 */
export function workerElder_add(data) {
    return axios({
        url: "/person/workerElder",
        method: "post",
        data: data
    })
}
